
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
A tiny TypeScript friendly event emitter that supports lazy re-emitting events form other sources.
npm add remitter
import { Remitter } from "remitter";
interface EventData {
event1: string;
event2: void;
}
const remitter = new Remitter<EventData>();
const disposer = remitter.on("event1", value => {
console.log("event1", value);
});
remitter.once("event1", value => {
console.log("event1-once", value);
});
remitter.count("event1"); // 2
remitter.emit("event1", "hello"); // logs "event1 hello" and "event1-once hello"
remitter.emit("event1", "hello"); // logs "event1 hello"
remitter.emit("event2"); // nothing logs
disposer();
remitter.emit("event1", "world"); // nothing logs
remitter.clear("event2"); // remove all listeners for event2
remitter.count(); // 0
remitter.dispose(); // removes all listeners and dispose tapped events
import { Remitter } from "remitter";
interface EventData {
event1: string;
event2: string;
}
const remitter = new Remitter<EventData>();
remitter.on(remitter.ANY_EVENT, ({ event, data }) => {
console.log(event, data);
});
remitter.emit("event1", "hello"); // logs "event1 hello"
remitter.emit("event2", "world"); // logs "event2 world"
You may tap into other events easily with remit
. It is lazy-executed when listener count of the event name grows from 0 to 1. It is disposed when listener count of the event name drops from 1 to 0.
remitter.remit("cursor", () => {
const handler = ev => {
remitter.emit("cursor", { x: ev.clientX, y: ev.clientY });
};
window.addEventListener("mousemove", handler);
return () => {
window.removeListener("mousemove", handler);
};
});
// Remit callback does not execute until the first "cursor" listener is added
remitter.on("cursor", value => {
console.log("cursor", value);
});
// Remit callback is disposed when no listener on the
// "cursor" event. (`window.removeListener` triggered)
remitter.clear("cursor");
The callback function can also be a pure function.
const myCursorEvent = remitter => {
const handler = ev => {
remitter.emit("cursor", { x: ev.clientX, y: ev.clientY });
};
window.addEventListener("mousemove", handler);
return () => {
window.removeListener("mousemove", handler);
};
};
remitter.remit("cursor", myCursorEvent);
Huge thanks to @recursivefunk for giving away the NPM package name remitter
.
FAQs
A TypeScript friendly event emitter with easy re-emitting events.
The npm package remitter receives a total of 798 weekly downloads. As such, remitter popularity was classified as not popular.
We found that remitter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.